/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package goldbech;
import java.io.*;
import java.math.*;
/**
 *
 * @author hhl
 */
public class Goldbech {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        int input=0,mode=0;
        boolean dispose=true;
        String s="";
        while(dispose){
            System.out.println("请选择模式：（1=执行/其它=退出）");
            try{
                BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
                s=in.readLine();
            }
            catch(IOException e){}
            mode=Integer.parseInt(s);
            switch(mode){
                case 1:
                    System.out.println("请输入一个偶数：");
                    try{
                        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
                        s=in.readLine();
                    }
                    catch(IOException e){}
                    input=Integer.parseInt(s);
                    if(input%2==0){
                        Divide(input);
                    }
                    else
                        System.out.println(input+"不是偶数，请重新输入！");
                    break;
                case 2:
                    System.out.println("期待下次再见！");
                    dispose=false;
                    break;
            }
        }
    }
    static void Divide(int input){
        for(int i=2;i<input/2+1;i++){
            if(Judge(i)&&Judge(input-i)){
                System.out.println("分解的结果为："+input+"="+i+"+"+(input-i));
            }
        }

    }
    static boolean Judge(int even){
        int j=2;
        for(j=2;j<Math.sqrt(even);j++){
            if(even%j==0)
            break;
        }
        if(j>Math.sqrt(even))
            return true;
        else
            return false;
    }

}
